void on_regok_clicked();
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtNetwork>
#include <QTcpServer>
#include <QTcpSocket>
#include <QTimer>
#include <QAbstractSocket>
#include <QList>
#include <QToolButton>
#include "usr.h"

namespace Ui {
class MainWindow;
}
/* 定义所有命令枚举 */
enum {

    /* 登录, 注册, 预约, 支付, 注销, 取车*/
    LOGIN, JOIN, PAY, DELETE_USR, RESERVATION, PICK_CAR,

    /* 登录成功, 注册成功, 注销成功, 支付成功, 预约成功, 取车成功 */
    LOGIN_OK, JOIN_OK, DELETE_USR_OK, PAY_OK, RESERVATION_OK, PICK_CAR_OK,

    /* 未找到用户, 密码错误, 要求客户端显示字符串 */
    NOT_FOUNT_USR, PASSWORD_ERR, RESERVATION_ERR, SHOW,

};

enum{
   showPage = 0,mapPage,resPage,userPage,logPage,regPage

};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public:
    void initsock();
    void initForm();
    void newTcpConnect();
    void sendInfo(int cmd, const QString &data);
    void slot_connecct();


private slots:


    void Slot_recvInfo();

    void buttonClick();

    void on_regok_clicked();

    void on_pushButton_clicked();

    void on_logbtn_clicked();

    void on_getcar_clicked();

    void on_regbtn_clicked();

    void on_logoutbtn_clicked();

    void on_delbtn_clicked();

private:
    Ui::MainWindow *ui;

    QTcpSocket *tcpSocket;

    QByteArray mChat;
    QList<int> pixChar;
    QList<QToolButton *> btns;
    Usr *user;
    bool isLogin = false;

};

#endif // MAINWINDOW_H
